//
//  VedioTableViewCell.m
//  FNer
//
//  Created by 王展 on 15/10/14.
//  Copyright (c) 2015年 wangzhan. All rights reserved.
//

#import "VedioTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation VedioTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createVideoCell];
    }
    return self;
}

-(void)createVideoCell
{
    self.videoImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 200 * XHIGHT)];
//    self.videoImageView.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.videoImageView];
    
    UIView *boliView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 200 * XHIGHT)];
    boliView.backgroundColor = [UIColor colorWithRed:30 / 255.0 green:30 /255.0 blue:30 / 255.0 alpha:0.1];
    [self.videoImageView addSubview:boliView];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 40 * XHIGHT)];
    self.nameLabel.center = CGPointMake(WIDTH / 2, 100 * XHIGHT);
//    self.nameLabel.backgroundColor = [UIColor blackColor];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    self.nameLabel.textColor = [UIColor whiteColor];
    self.nameLabel.font = [UIFont fontWithName:@"Helvetica-BoldOblique" size:19 * XWIDTH];
    
    self.cateGoryLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 30 * XHIGHT)];
    self.cateGoryLabel.center = CGPointMake(WIDTH / 2, 135 * XHIGHT);
//    self.cateGoryLabel.backgroundColor = [UIColor redColor];
    self.cateGoryLabel.textColor = [UIColor whiteColor];
    self.cateGoryLabel.font = [UIFont systemFontOfSize:17 * XWIDTH];
    self.cateGoryLabel.textAlignment = NSTextAlignmentCenter;
    
    self.nameLabel.alpha = 1.0;
    self.cateGoryLabel.alpha = 1.0;
    
    [boliView addSubview:self.cateGoryLabel];
    [boliView addSubview:self.nameLabel];
    

}

-(void)setAVideo:(Video *)aVideo
{
    _aVideo = aVideo;
    [self.videoImageView sd_setImageWithURL:[NSURL URLWithString:self.aVideo.coverForFeed]];
    self.nameLabel.text = self.aVideo.title;
    self.cateGoryLabel.text = [NSString stringWithFormat:@"# %@",self.aVideo.category];
    

}





@end
